package com.mq.batch.consumer2;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author ytj
 * @date 2024/1/15
 */
@Component
public class Demo6Producer {
    @Resource
    private RabbitTemplate rabbitTemplate;

    public void send(Integer id){
        System.out.println("发送消息:"+id);
        Demo6Message demo6Message=new Demo6Message(id);
        this.rabbitTemplate.convertAndSend(Demo6Message.EXCHANGE_NAME,Demo6Message.ROUTE_KEY,demo6Message);
    }
}
